package com.zb.zeus.common.core.web.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.util.ArrayList;
import java.util.List;

/**
 * Tree基类
 * 
 * @author zb.zeus
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class TreeEntity extends BaseEntity {

    private static final long serialVersionUID = -4175050964687211498L;

    /** 父菜单名称 */
    @TableField(exist = false)
    @ApiModelProperty(value = "父菜单名称")
    private String parentName;

    /** 父菜单ID */
    @TableField(value = "parent_id")
    @ApiModelProperty(value = "父菜单ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long parentId;

    /** 从根到当前节点的id路径。例：1,3,8001000 */
    @TableField(value = "full_path")
    @ApiModelProperty(value = "从根到当前节点的id路径。例：1,3,8001000")
    private String fullPath;

    /** 子组织 */
    @TableField(exist = false)
    @ApiModelProperty(value = "子节点")
    private List<?> children = new ArrayList<>();

}
